<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>选择</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }
    </style>
</head>
<body>
    
    <script type="text/javascript">
        /* 
        几个内容的组合作为选择条件，[] 不再适用
        使用 | 来解决多个内容捆绑匹配的 或 语法
        */

        var str = "abcdefg";

        console.log(str.match(/[abcd]/g)); // [a, b, c, d]

        console.log(str.match(/abc|def|g/g)); // [abc, def, g]
    </script>
</body>
</html>